/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Diana
 */
@Entity
@Table(name = "empleado", catalog = "nomina", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Empleado.findAll", query = "SELECT e FROM Empleado e"),
    @NamedQuery(name = "Empleado.findByIdempleado", query = "SELECT e FROM Empleado e WHERE e.idempleado = :idempleado"),
    @NamedQuery(name = "Empleado.findByTipo", query = "SELECT e FROM Empleado e WHERE e.tipo = :tipo"),
    @NamedQuery(name = "Empleado.findByCedula", query = "SELECT e FROM Empleado e WHERE e.cedula = :cedula"),
    @NamedQuery(name = "Empleado.findByNombre", query = "SELECT e FROM Empleado e WHERE e.nombre = :nombre"),
    @NamedQuery(name = "Empleado.findBySalario", query = "SELECT e FROM Empleado e WHERE e.salario = :salario")})
public class Empleado implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idempleado")
    private String idempleado;
    @Column(name = "tipo")
    private String tipo;
    @Column(name = "cedula")
    private String cedula;
    @Column(name = "nombre")
    private String nombre;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "salario")
    private Float salario;
    @JoinColumn(name = "cargo_idcargo", referencedColumnName = "idcargo")
    @ManyToOne(optional = false)
    private Cargo cargoIdcargo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "empleadoIdempleado")
    private List<Detallenomina> detallenominaList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "empleadoIdempleado")
    private List<Maternidad> maternidadList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "empleadoIdempleado")
    private List<Deuda> deudaList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "empleadoIdempleado")
    private List<Incapacidad> incapacidadList;

    public Empleado() {
    }

    public Empleado(String idempleado) {
        this.idempleado = idempleado;
    }

    public String getIdempleado() {
        return idempleado;
    }

    public void setIdempleado(String idempleado) {
        this.idempleado = idempleado;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    public String getCedula() {
        return cedula;
    }

    public void setCedula(String cedula) {
        this.cedula = cedula;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public Float getSalario() {
        return salario;
    }

    public void setSalario(Float salario) {
        this.salario = salario;
    }

    public Cargo getCargoIdcargo() {
        return cargoIdcargo;
    }

    public void setCargoIdcargo(Cargo cargoIdcargo) {
        this.cargoIdcargo = cargoIdcargo;
    }

    @XmlTransient
    public List<Detallenomina> getDetallenominaList() {
        return detallenominaList;
    }

    public void setDetallenominaList(List<Detallenomina> detallenominaList) {
        this.detallenominaList = detallenominaList;
    }

    @XmlTransient
    public List<Maternidad> getMaternidadList() {
        return maternidadList;
    }

    public void setMaternidadList(List<Maternidad> maternidadList) {
        this.maternidadList = maternidadList;
    }

    @XmlTransient
    public List<Deuda> getDeudaList() {
        return deudaList;
    }

    public void setDeudaList(List<Deuda> deudaList) {
        this.deudaList = deudaList;
    }

    @XmlTransient
    public List<Incapacidad> getIncapacidadList() {
        return incapacidadList;
    }

    public void setIncapacidadList(List<Incapacidad> incapacidadList) {
        this.incapacidadList = incapacidadList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idempleado != null ? idempleado.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Empleado)) {
            return false;
        }
        Empleado other = (Empleado) object;
        if ((this.idempleado == null && other.idempleado != null) || (this.idempleado != null && !this.idempleado.equals(other.idempleado))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "modelo.Empleado[ idempleado=" + idempleado + " ]";
    }
    
}
